---
title: "AI Chat Assistant - Introduction"
description: "Transform how you interact with databases using WhoDB's natural language AI assistant"
---

# AI Chat Assistant - Introduction

WhoDB's AI Chat Assistant revolutionizes database interaction by letting you use natural language instead of SQL. Ask questions in plain English, and the assistant generates accurate queries, executes them, and presents results in an intuitive format.

<Tip>
The AI Chat Assistant is like having an expert database administrator and SQL developer available 24/7
</Tip>

## What is the AI Chat Assistant?

The AI Chat Assistant bridges the gap between human language and database queries. Instead of remembering SQL syntax, table names, or join conditions, you simply describe what you want to know.

![Chat Initial Page](/images/101-chat-initial-page.png)

### Key Capabilities

<CardGroup cols={2}>
<Card title="Natural Language Queries" icon="message-lines">
Ask questions in plain English and get structured results
</Card>
<Card title="Automatic SQL Generation" icon="code">
The assistant writes optimized SQL based on your database schema
</Card>
<Card title="Multi-Database Support" icon="database">
Works with PostgreSQL, MySQL, MongoDB, SQLite, Redis, and more
</Card>
<Card title="Multiple AI Providers" icon="brain">
Choose from OpenAI, Anthropic, Ollama, or custom providers
</Card>
<Card title="Contextual Conversations" icon="comments">
Maintains conversation history for follow-up questions
</Card>
<Card title="Safe Data Modification" icon="shield-check">
Requires explicit confirmation for updates, deletes, and inserts
</Card>
</CardGroup>

## How It Works

The AI Chat Assistant follows a simple workflow:

<Steps>
<Step title="You Ask a Question">
Type your question in natural language:
- "Show me all users"
- "What's the total revenue this month?"
- "Find products that are out of stock"
</Step>
<Step title="AI Generates SQL">
The assistant analyzes your question and your database schema to create the appropriate SQL query.

<Info>
The assistant has full awareness of your tables, columns, relationships, and database type
</Info>
</Step>
<Step title="Query Executes">
WhoDB runs the generated SQL against your database with proper security and timeout controls.
</Step>
<Step title="Results Display">
Results appear in an interactive table with sorting, filtering, and export capabilities.
</Step>
</Steps>

## Who Should Use the AI Assistant?

### Complete Beginners

Never written SQL before? The AI assistant is perfect for you:
- No SQL knowledge required
- Learn by seeing how questions translate to queries
- Explore databases without fear of making mistakes
- Get immediate results without syntax errors

### Data Analysts

Speed up your analysis workflow:
- Generate complex aggregations in seconds
- Explore data relationships naturally
- Create ad-hoc reports without writing SQL
- Focus on insights, not query syntax

### Developers

Accelerate development tasks:
- Quickly understand unfamiliar database schemas
- Test queries before implementing in code
- Debug data issues in development and production
- Prototype features without writing boilerplate SQL

### Database Administrators

Simplify routine tasks:
- Run diagnostics with natural language commands
- Generate reports for stakeholders
- Validate data integrity
- Perform maintenance queries efficiently

## Example Interactions

### Simple Data Retrieval

**You**: "Show me all users"

**Assistant**: "Here are all the users in the database."

Result: Interactive table with all user records

---

**You**: "Find users created in the last week"

**Assistant**: [Generates and executes appropriate date filter query]

Result: Filtered user list with recent signups

### Complex Analysis

**You**: "Count users by email domain"

**Assistant**: "Here's the user count by email domain."

Result: Aggregated data showing domain distribution

---

**You**: "Show average order value by month for the last year"

**Assistant**: [Generates query with date grouping and aggregation]

Result: Monthly revenue analysis table

### Data Modification

**You**: "Delete user with id 5"

**Assistant**: "Are you sure you want to delete this user? This action cannot be undone. Please confirm to proceed."

**You**: "Yes, delete it"

**Assistant**: [Executes DELETE and confirms]

Result: "Action Executed - 1 row affected"

## Supported AI Providers

WhoDB supports multiple AI providers, giving you flexibility based on your needs:

<AccordionGroup>
<Accordion title="OpenAI (GPT Models)">
**Best for**: Most users, general-purpose queries

**Models Available**:
- GPT-4: Most capable, best for complex queries
- GPT-3.5 Turbo: Fast, cost-effective for simple queries

**Requirements**: OpenAI API key

**Pros**:
- Highly accurate SQL generation
- Fast response times
- Excellent natural language understanding

**Cons**:
- Requires paid API key
- Data sent to external servers
</Accordion>
<Accordion title="Anthropic (Claude Models)">
**Best for**: Complex reasoning, large context windows

**Models Available**:
- Claude 3.5 Sonnet: Balanced performance and speed
- Claude 3 Opus: Maximum capability

**Requirements**: Anthropic API key

**Pros**:
- Excellent handling of complex queries
- Very large context windows
- Strong reasoning capabilities

**Cons**:
- Requires paid API key
- Data sent to external servers
</Accordion>
<Accordion title="Ollama (Local Models)">
**Best for**: Privacy-focused deployments, no API costs

**Models Available**:
- Llama 3.1: Open-source, highly capable
- Mistral: Fast, efficient
- CodeLlama: Optimized for code generation
- Many others available

**Requirements**: Ollama installed locally

**Pros**:
- Complete data privacy (runs locally)
- No API costs
- No internet required
- Full control over model selection

**Cons**:
- Requires local installation
- Slower than cloud providers
- Requires sufficient local hardware
</Accordion>
<Accordion title="Custom Providers">
**Best for**: Enterprise deployments, specific requirements

Configure custom AI endpoints for:
- Self-hosted models
- Enterprise AI platforms
- Specialized database assistants

Contact your administrator for configuration details.
</Accordion>
</AccordionGroup>

## Privacy and Security

### Data Privacy Considerations

<CardGroup cols={2}>
<Card title="External Providers (OpenAI, Anthropic)" icon="cloud">
**What's Sent**: Your database schema and query text
**Not Sent**: Actual database data or query results
**Consideration**: Review your organization's policies on external AI services
</Card>
<Card title="Local Models (Ollama)" icon="server">
**What's Sent**: Nothing—all processing is local
**Privacy**: Complete data isolation
**Consideration**: Ideal for sensitive or regulated environments
</Card>
</CardGroup>

<Warning>
For highly sensitive data, use local models (Ollama) or consult your security team before enabling external AI providers
</Warning>

### Security Features

- **Confirmation Required**: All data modifications require explicit confirmation
- **Read-Only Mode**: Can be configured with read-only database users
- **Query Timeouts**: Automatic timeout prevents runaway queries
- **Audit Trail**: All queries are logged for compliance
- **Permission Aware**: Respects your database user permissions

## Getting Started

Ready to use the AI Chat Assistant? Follow these steps:

<Steps>
<Step title="Choose Your AI Provider">
Decide between external providers (OpenAI, Anthropic) or local models (Ollama).

<Card title="Quick Decision Guide" icon="lightbulb">
- **Use External Providers** if: You want the best accuracy and speed
- **Use Ollama** if: Privacy is critical or you want zero API costs
</Card>
</Step>
<Step title="Set Up Your Provider">
Configure your chosen AI provider with necessary credentials.

[Learn how to set up providers →](/ai/setup-providers)
</Step>
<Step title="Start Asking Questions">
Navigate to the Chat page and begin exploring your database.

[See querying guide →](/ai/querying-data)
</Step>
</Steps>

## AI Assistant Features Overview

### Core Features

- **Natural Language Understanding**: Ask questions conversationally
- **Schema Awareness**: Knows your tables, columns, and relationships
- **SQL Generation**: Creates optimized, database-specific queries
- **Result Display**: Interactive tables with full functionality
- **Error Handling**: Clear explanations when queries fail

### Advanced Features

- **Conversation Context**: Follow-up questions build on previous queries
- **Multi-Turn Dialogues**: Complex analysis through iterative refinement
- **SQL Code View**: Toggle between results and generated SQL
- **Scratchpad Integration**: Move queries to Scratchpad for refinement
- **Query History**: Navigate through previous questions with keyboard shortcuts

### Data Operations

- **SELECT Queries**: Retrieve and analyze data
- **Aggregations**: COUNT, SUM, AVG, MIN, MAX automatically applied
- **Filtering**: WHERE conditions from natural language
- **Sorting**: ORDER BY inferred from context
- **Joins**: Multi-table queries generated correctly
- **INSERT/UPDATE/DELETE**: Safe data modifications with confirmation

## Use Case Examples

<CardGroup cols={2}>
<Card title="Data Exploration" icon="compass" href="/use-cases/ai-data-exploration">
Quickly understand unfamiliar databases
</Card>
<Card title="Ad-Hoc Reporting" icon="chart-line" href="/ai/querying-data">
Generate reports without writing SQL
</Card>
<Card title="Learning SQL" icon="graduation-cap" href="/guides/tutorials/ai-first-query">
See how natural language translates to SQL
</Card>
<Card title="Data Validation" icon="check-circle" href="/ai/querying-data">
Find data quality issues efficiently
</Card>
</CardGroup>

## Comparison: Traditional SQL vs. AI Assistant

| Task | Traditional Approach | With AI Assistant |
|------|---------------------|-------------------|
| Find all users | Write `SELECT * FROM users` | Ask "Show me all users" |
| Complex aggregation | Write GROUP BY with multiple joins | Ask "Count orders by product category" |
| Filter by date | Remember date syntax for your database | Ask "Show orders from last month" |
| Debug query | Read error message, fix syntax | Rephrase question naturally |
| Learn schema | Query information_schema tables | Ask "What tables exist?" |
| Data modification | Write UPDATE/DELETE carefully | Describe change, confirm when prompted |

The AI assistant eliminates syntax memorization and reduces the time from question to insight.

## Limitations

While powerful, the AI assistant has some limitations:

<AccordionGroup>
<Accordion title="Query Complexity">
Extremely complex multi-step operations may require:
- Breaking into multiple queries
- Manual refinement in Scratchpad
- Traditional SQL for edge cases
</Accordion>
<Accordion title="Database Permissions">
The assistant respects your database user permissions:
- Cannot perform operations beyond granted privileges
- No elevation of user permissions
- Same access as manual SQL queries
</Accordion>
<Accordion title="Response Time">
Query generation depends on:
- AI provider speed
- Network latency (for external providers)
- Database query execution time
- Schema complexity
</Accordion>
<Accordion title="Accuracy">
While highly accurate, the assistant may occasionally:
- Misinterpret ambiguous questions
- Generate suboptimal queries for very specific needs
- Require clarification for context-dependent requests

Always review generated SQL for critical operations.
</Accordion>
</AccordionGroup>

## Best Practices

<Tip>
Start specific, then generalize. Instead of "show me the data," ask "show me all users created this month"
</Tip>

Key practices for effective AI assistant use:

1. **Be Specific**: Clear questions get better results
2. **Provide Context**: Mention table names when ambiguous
3. **Verify SQL**: Review generated queries for important operations
4. **Use Confirmation**: Take advantage of modification confirmations
5. **Leverage Context**: Build on previous questions in conversation
6. **Move to Scratchpad**: Save useful queries for reuse

[Learn more best practices →](/best-practices/ai-usage)

## Next Steps

<CardGroup cols={2}>
<Card title="Set Up Providers" icon="gear" href="/ai/setup-providers">
Configure OpenAI, Anthropic, or Ollama for your needs
</Card>
<Card title="Querying Data" icon="magnifying-glass" href="/ai/querying-data">
Learn how to ask questions and retrieve data
</Card>
<Card title="Your First AI Query" icon="rocket" href="/guides/tutorials/ai-first-query">
Step-by-step tutorial for beginners
</Card>
<Card title="Modifying Data" icon="pen-to-square" href="/ai/modifying-data">
Safely update, insert, and delete records
</Card>
</CardGroup>

<Check>
The AI Chat Assistant makes database interaction accessible to everyone, from complete beginners to experienced professionals
</Check>
